import request from '@/config/axios'
import type { Language } from './types'

export const getLanguagesListApi = (params: any): Promise<IResponse> => {
  return request.get({ url: '/languages', params })
}

export const createLanguagesApi = (data: Partial<Language>): Promise<IResponse> => {
  return request.post({ url: '/languages', data })
}

export const updateLanguagesApi = (id: string, data: Partial<Language>): Promise<IResponse> => {
  return request.put({ url: `/languages/id/${id}`, data })
}

export const getLanguagesDetailApi = (id: string): Promise<IResponse<Language>> => {
  return request.get({ url: `/languages/id/${id}` })
}

export const delLanguagesListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.delete({ url: `/languages/id/${ids[0]}` })
}
